package com.yinlixian.frame.admin.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.yinlixian.frame.admin.entity.SysUser;
import com.yinlixian.frame.admin.mapper.SysUserMapper;
import com.yinlixian.frame.admin.service.ISysUserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户信息 服务实现类
 * </p>
 *
 * @author yudm
 * @since 2017-03-01
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
    @Override
    public SysUser findUserByToken(String token) {
        Wrapper<SysUser> wrapper = new EntityWrapper<>();
        wrapper.where("login_name = {0}",token).or("email = {0}",token).or("phone = {0}",token)
                .andNew("is_delete = 0");
        return selectOne(wrapper);
    }
}
